import http from '@/utils/request'

// 获取角色列表
export const getRoleList = (params) => {
  return http.post("/admin/role/rolePage", params);
};

// 删除角色
export const deleteRole = (params) => {
  return http.delete("/admin/role/delete", params);
};

// 修改角色
export const updateRole = (params) => {
  return http.post("/admin/role/update", params);
};

// 添加角色
export const addRole = (params) => {
  return http.post("/admin/role/insert", params);
};

// 根据id查询角色
export const getRoleById = (params) => {
  return http.get("/admin/role/selectById", params);
};

/**
 * 获取角色接口权限
 */
export const getRolePermission = (roleId) => {
  return http.get("/admin/rolePermission/getRolePermission", { roleId: roleId });
};

/**
 * 保存角色接口权限
 */
export const saveRolePermission = (idList) => {
  return http.post("/admin/rolePermission/saveRolePermission", idList);
};

/**
 * 获取角色元素权限
 */
export const getRoleElement = (roleId) => {
  return http.get("/admin/roleElement/getRoleElement", { roleId: roleId });
};


/**
 * 保存角色元素权限
 */
export const saveRoleElements = (idList) => {
  return http.post("/admin/roleElement/saveRoleElements", idList);
};